package com.abc.qq.view.udp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class Server {
    public static void main(String[] args) {
        try {
            DatagramSocket datagramSocket = new DatagramSocket(8888);
            byte[] cache = new byte[100];
            DatagramPacket dp = new DatagramPacket(cache, cache.length);
            datagramSocket.receive(dp);
            System.out.println(new String(dp.getData()).trim());
            datagramSocket.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
